package cc.ruih.meizanchen.mm;

import cc.ruih.meizanchen.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ScrollView;

/**
 * 分娩知多少
 * @author Ruih
 *
 */
public class Childbirth extends Activity {

	ImageButton jiantou1;		// 分娩知多少的箭头
	ImageButton jiantou2;		// 减痛分娩法的箭头
	int jt1=1;	// 分娩知多少的箭头为开，1为开0为关
	int jt2=0;
	LinearLayout layout1;
	LinearLayout layout2;
	private WebView scgc;	// 生产过程早了解HTML内容
	private WebView jtfmf;	// 生产过程早了解HTML内容
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mm_fmzds);
		jiantou1 = (ImageButton) findViewById(R.id.jiantou1);
		jiantou2 = (ImageButton) findViewById(R.id.jiantou2);
		layout1 = (LinearLayout) findViewById(R.id.layout1);
		layout2 = (LinearLayout) findViewById(R.id.layout2);
		jiantou1.setOnClickListener(new ButtonClick());
		jiantou2.setOnClickListener(new ButtonClick());
		
		scgc = (WebView) findViewById(R.id.web_scgc);
		scgc.loadUrl("file:///android_asset/scgc.html");  
		jtfmf = (WebView) findViewById(R.id.web_jtfmf);
		jtfmf.loadUrl("file:///android_asset/jtfmf.html");
	}
	
	private class ButtonClick implements OnClickListener{
		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.jiantou1:
				if(jt1==0){
					jt1=1;
					jiantou1.setBackgroundResource(R.drawable.arrow_down);
					layout1.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
				}else{
					jt1=0;
					jiantou1.setBackgroundResource(R.drawable.arrow);
					layout1.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 0));
				}
				break;
			case R.id.jiantou2:
				if(jt2==0){
					jt2=1;
					jiantou2.setBackgroundResource(R.drawable.arrow_down);
					layout2.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
				}else{
					jt2=0;
					jiantou2.setBackgroundResource(R.drawable.arrow);
					layout2.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 0));
				}
				break;
			}
		}
	}
	
}
